﻿<?php
$bdd = new PDO('mysql:host=localhost;dbname=brin_de_soleil', 'root', '');

$reponse = $bdd->prepare('SELECT * FROM prospect INNER JOIN etablissement ON etablissement.id_etablissement=prospect.id_etablissement 
							INNER JOIN adresse ON adresse.id_adresse=etablissement.id_adresse
							INNER JOIN coordonnee ON etablissement.id_coordonnee=coordonnee.id_coordonnee
							INNER JOIN ville ON adresse.id_ville= ville.id_ville WHERE departement = :departement
OR classification = :classification OR matricule = :matricule OR nom_etablissement = :etablissement OR qualite = :qualite');
$reponse->execute(array(
		'departement' => $_POST['departement'],
		'classification' => $_POST['classification'],
		'matricule' => $_POST['matricule'],
		'etablissement' => $_POST['etablissement'],
		'qualite' => $_POST['qualite'],
	));
	
		echo"<table border= 1>";
		echo"<tr align= center>";
				echo"<td><b>Matricule</b></td>";
				echo"<td><b>Date création</b></td>";
				echo"<td><b>Qualité</b></td>";
				echo"<td><b>Num poste</b></td>";
				echo"<td><b>Région</b></td>";
				echo"<td><b>Département</b></td>";
				echo"<td><b>Classification</b></td>";
				echo"<td><b>Num salariés</b></td>";
				echo"<td><b>Nb particip. concernés</b></td>";
				echo"<td><b>Potentiel particip.</b></td>";
				echo"<td><b>Nb brochures</b></td>";
				echo"<td><b>Date hiver</b></td>";
				echo"<td><b>Date inscription hiver</b></td>";
				echo"<td><b>Date été</b></td>";
				echo"<td><b>Date inscription été</b></td>";
				echo"<td><b>Fonctionnement collect.</b></td>";
				echo"<td><b>Rue</b></td>";
				echo"<td><b>Code postal</b></td>";
				echo"<td><b>Téléphone 1</b></td>";
				echo"<td><b>Téléphone 2</b></td>";
				echo"<td><b>Fax</b></td>";
				echo"<td><b>Email</b></td>";
				echo"<td><b>Nom établissement</b></td>";
				echo"<td><b>Ville</b></td>";
			echo"</tr>";
		while ($donnees = $reponse->fetch())
		{
			echo"<tr>";
				echo "<td><input style='text-align:center' type=text value='".$donnees['matricule']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['date_creation']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['qualite']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['num_poste']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['region']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['departement']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['classification']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['num_salaries']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['nb_particip_concerne']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['potentiel_particip']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['nbbrochure']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['date_hiver']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['date_inscription_hiver']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['date_ete']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['date_inscription_ete']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['fonctionnement_collect']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['rue']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['code_postal']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['telephone1']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['telephone2']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['fax']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['mail']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['nom_etablissement']."'/></td>";		
				echo "<td><input style='text-align:center' type=text value='".$donnees['ville']."'/></td>";		
			echo"</tr>";
		}
		echo"</table>";
?>